package com.example.module_motocircle.http

import com.example.lib_net.BaseResponse
import com.example.module_motocircle.model.MotoCircleNavigationItem
import com.example.module_motocircle.model.PostCommentsPageModel
import com.example.module_motocircle.model.PostListModel
import com.example.module_motocircle.model.PostModel
import com.example.module_motocircle.model.SearchHotDataModel
import com.example.module_motocircle.model.SearchSuggestionModel
import retrofit2.http.GET
import retrofit2.http.Query

interface MotorCircleApi {

    /*
    导航
     */
    @GET("/app/motorCircle/navigationItem")
    suspend fun navigationItem(): BaseResponse<List<MotoCircleNavigationItem>>


    /*
    是否有关注的人
     */
    @GET("/app/friend/checkIfHasFocus")
    suspend fun checkIfHasFocus(): BaseResponse<Boolean>

    /*
    帖子列表
     */
    //http://10.161.9.80:8886/app/postsInfo/pageList?isFocus=0&pageNum=1&pageSize=3&sortType=new
    //http://10.161.9.80:8886/app/postsInfo/pageList?isFocus=0&pageNum=1&pageSize=3&sortType=hot
    //http://10.161.9.80:8886/app/postsInfo/pageList?sortBy=new&isFocus=0&pageNum=1&pageSize=10
    @GET("/app/postsInfo/pageList")
    suspend fun pageList(
        @Query("sortType") sortBy: String? = null,
        @Query("topicId") topicId: String? = null,
        @Query("memberId") memberId: String? = null,
        @Query("isFocus") ifFocus: Int? = null,
        @Query("pageNum") pageNum: Int,
        @Query("pageSize") pageSize: Int = 10,
        @Query("keyword") keyword: String? = null
    ): BaseResponse<PostListModel>
    /**
     * 校验帖子
     */
    @GET("/app/postsInfo/giveValidationLike")
    suspend fun giveValidationLike(
        @Query("postsId") postsId: String
    ):BaseResponse<Boolean>

    /**
     * 点赞帖子
     */
    @GET("/app/postsInfo/giveLike")
    suspend fun giveLike(
        @Query("postsId") postsId: String
    ):BaseResponse<Boolean>

    /*
    关键字搜索
     */
    @GET("/app/search/searchKeywordList")
    suspend fun searchKeyword(
        @Query("keyword") keyword: String,
        @Query("socialType") serviceType: Int = 1
    ): BaseResponse<List<SearchSuggestionModel>>

    @GET("/app/search/hotTopics")
    suspend fun getSearchHotData(): BaseResponse<SearchHotDataModel>

    //"http://10.161.9.80:8886/app/postsInfo/getByPostsId?postsId=1905528400386129921"
    @GET("/app/postsInfo/getByPostsId?postsId=1905528400386129921")
    suspend fun PostDetail(): BaseResponse<PostModel>

    /**
     * 分页获取帖子的评论
     */
    @GET("/app/postsComment/pageComment?pageNum=1&pageSize=10&postsId=1905528400386129921")
    suspend fun queryPostCommentsByPage(
        @Query("pageNum") pageNum: Int,
        @Query("pageSize") pageSize: Int = 10
    ): BaseResponse<PostCommentsPageModel>
}